//
//  GuideViewController.m
//  sentorise
//
//  Created by admin on 2025/9/4.
//

#import "GuideViewController.h"
#import "GlobalDefine.h"

@interface GuideViewController ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topSpace;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentH1;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentH2;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentH3;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *contentH4;

@property (weak, nonatomic) IBOutlet UILabel *tipsLabel1;
@property (weak, nonatomic) IBOutlet UILabel *tipsLabel2;
@property (weak, nonatomic) IBOutlet UILabel *tipsLabel3;
@property (weak, nonatomic) IBOutlet UILabel *tipsLabel4;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *itemTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *itemDescLabel1;
@property (weak, nonatomic) IBOutlet UILabel *itemDescLabel2;
@property (weak, nonatomic) IBOutlet UILabel *itemDescLabel3;
@property (weak, nonatomic) IBOutlet UILabel *itemDescLabel4;

@property (weak, nonatomic) IBOutlet UILabel *item2TitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *item2DescLabel1;

@property (weak, nonatomic) IBOutlet UILabel *item3TitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *item3DescLabel1;
@property (weak, nonatomic) IBOutlet UILabel *item3DescLabel2;
@property (weak, nonatomic) IBOutlet UILabel *item3DescLabel3;

@property (weak, nonatomic) IBOutlet UILabel *item4TitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *item4DescLabel1;
@property (weak, nonatomic) IBOutlet UILabel *item4DescLabel2;
@property (weak, nonatomic) IBOutlet UILabel *item4DescLabel3;

@end

@implementation GuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.topSpace.constant = IphoneX ? 54 : 20;
    
    self.titleLabel.text = NSLocalizedString(@"User Guide", nil);
    
    self.itemTitleLabel.text = NSLocalizedString(@"Device cannot connect?Solution:", nil);
    self.itemDescLabel1.text = NSLocalizedString(@"1. Make sure the device is powered on.", nil);
    self.itemDescLabel2.text = NSLocalizedString(@"Note: When the power is turned off, the battery can be charged and then turned on. At the same time, the battery Bluetooth module will also be turned on at the same time", nil);
    self.itemDescLabel3.text = NSLocalizedString(@"2. If the device is far away from the phone or is blocked, please shorten the distance between the device and the phone or move it closer.", nil);
    self.itemDescLabel4.text = NSLocalizedString(@"3. Use \"Search Bluetooth\" to add adevice to see if the corresponding device can be found and try to reconnect to it.", nil);
    
    self.item2TitleLabel.text = NSLocalizedString(@"How to check the name of a connected device?", nil);
    self.item2DescLabel1.text = NSLocalizedString(@"The Bluetooth module name information has been printed on the device label sticker, there are differences in the posting position of different batches of products, please check the device or package", nil);

    self.item3TitleLabel.text = NSLocalizedString(@"How to turn on Bluetooth module?", nil);
    self.item3DescLabel1.text = NSLocalizedString(@"In the following two cases, the Bluetooth module that comes with the device will turn off, you just need to charge the battery, and the Bluetooth module will automatically turn on.", nil);
    self.item3DescLabel2.text = NSLocalizedString(@"1. When the battery is shipped out of the box, it will be turned off by default", nil);
    self.item3DescLabel3.text = NSLocalizedString(@"2.When the battery is depleted, it will automatically turn off", nil);

    self.item4TitleLabel.text = NSLocalizedString(@"Device control instructions", nil);
    self.item4DescLabel1.text = NSLocalizedString(@"-Discharge switch\nControls whether the battery can be discharged.\nNote: The discharge switch is only supported by the APP, please use it with caution.", nil);
    self.item4DescLabel2.text = NSLocalizedString(@"-Turn off the power\nConfirming that the power off will immediately shut down the battery and disconnect the current device from Bluetooth.", nil);
    self.item4DescLabel3.text = NSLocalizedString(@"-Turn on the power\nCharge the battery to turn on the power and Bluetooth will also turn on at the same time.", nil);
}

- (IBAction)actionBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)actionShow1:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.contentH1.constant = sender.selected ? 350 : 80;
    self.tipsLabel1.hidden = !sender.selected;
}

- (IBAction)actionShow2:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.contentH2.constant = sender.selected ? 220 : 90;
    self.tipsLabel2.hidden = !sender.selected;
}

- (IBAction)actionShow3:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.contentH3.constant = sender.selected ? 280 : 80;
    self.tipsLabel3.hidden = !sender.selected;
}

- (IBAction)actionShow4:(UIButton *)sender {
    sender.selected = !sender.selected;
    self.contentH4.constant = sender.selected ? 390 : 80;
    self.tipsLabel4.hidden = !sender.selected;
}

@end
